package cn.myjerry.io.charIO;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/**
 * 纯文本的写出
 * @author Jerry
 *
 */
public class Demo02 {
	public static void main(String[] args) {
		String path = "/Users/zpon/Desktop/test.txt";
		File src = new File(path);
		Writer writer = null;
		try {
			writer = new FileWriter(src, true);
			String str = "测试纯文本的写出";
			writer.write(str);
			writer.flush();
		} catch (IOException e) {
			e.printStackTrace();
			System.out.println("文件不存在");
		} finally {
			try {
				if(null == writer) {
					writer.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
				System.out.println("关闭流失败");
			}
		}
	}
}
